class Stack(object):
    def __init__(self):
        """
        initialize your data structure here.
        """
        self.queue = []

    def push(self, x):
        """
        :type x: int
        :rtype: nothing
        """
        self.queue.append(x)

    def pop(self):
        """
        :rtype: nothing
        """
        tmp = []
        for _ in range(len(self.queue)-1):
            tmp.append(self.queue[0])
            self.queue.pop(0)
        val = self.queue[0]
        self.queue = tmp
        return val

    def top(self):
        """
        :rtype: int
        """
        tmp = []
        val = None
        for _ in range(len(self.queue)):
            val = self.queue[0]
            self.queue.pop(0)
            tmp.append(val)
        self.queue = tmp
        return val

    def empty(self):
        """
        :rtype: bool
        """
        return len(self.queue)==0